<style>
	.button-table{
		margin-top:10px;
		margin-left:26px;
	}
</style>
<div class="row">
	<div class="col-lg-12">
		<div class="panel panel-default gradient">
			<div class="panel-heading">
				<h4>
					<span>Pilih Periode</span>
				</h4>
			</div>
			<div class="panel-body">
				<div class="col-lg-12">
					<?php if(!isset($id)){?>
						<select id="periode" class="form-control nostyle" onChange="ganti_periode()">
							<option value="0">Semua</option>
							<option value="99999999">Periode Aktif</option>
							<?php foreach($periode as $row){?>
								<option value="<?php echo $row['ID_PERIODE']?>"><?php echo date('d/m/Y',strtotime($row['TGL_AWAL']))." - ".date('d/m/Y',strtotime($row['TGL_AKHIR']));?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $row['KETERANGAN']?></option>
							<?php }?>
						</select>
					<?php }else{
						if($id == 99999999){
					?>
						<select id="periode" class="form-control nostyle" onChange="ganti_periode()">
							<option value="0">Semua</option>
							<option value="99999999" selected>Periode Aktif</option>
							<?php foreach($periode as $row){?>
								<option value="<?php echo $row['ID_PERIODE']?>"><?php echo date('d/m/Y',strtotime($row['TGL_AWAL']))." - ".date('d/m/Y',strtotime($row['TGL_AKHIR']));?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $row['KETERANGAN']?></option>
							<?php }?>
						</select>
					<?php }elseif($id == 0){?>
						<select id="periode" class="form-control nostyle" onChange="ganti_periode()">
							<option value="0">Semua</option>
							<option value="99999999">Periode Aktif</option>
							<?php foreach($periode as $row){?>
								<option value="<?php echo $row['ID_PERIODE']?>"><?php echo date('d/m/Y',strtotime($row['TGL_AWAL']))." - ".date('d/m/Y',strtotime($row['TGL_AKHIR']));?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $row['KETERANGAN']?></option>
							<?php }?>
						</select>
					<?php }else{?>
						<select id="periode" class="form-control nostyle" onChange="ganti_periode()">
							<option value="0">Semua</option>
							<option value="99999999">Periode Aktif</option>
							<option value="<?php echo $selected_periode['ID_PERIODE']?>" selected><?php echo date('d/m/Y',strtotime($selected_periode['TGL_AWAL']))." - ".date('d/m/Y',strtotime($selected_periode['TGL_AKHIR']));?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $selected_periode['KETERANGAN']?></option>
							<?php foreach($periode as $row){
								if($row['ID_PERIODE'] != $selected_periode['ID_PERIODE']){
							?>
								<option value="<?php echo $row['ID_PERIODE']?>"><?php echo date('d/m/Y',strtotime($row['TGL_AWAL']))." - ".date('d/m/Y',strtotime($row['TGL_AKHIR']));?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $row['KETERANGAN']?></option>
							<?php } }?>
						</select>
					<?php } }?>
				</div>
			</div>
		</div>
	</div>
</div>
<div class="row">
	<div class="col-lg-12">
		<div class="panel panel-default gradient">
			<div class="panel-heading">
				<h4>
					<span>Grid Ruas Jalan</span>
				</h4>
			</div>
			<div class="panel-body noPad clearfix">
				<table cellpadding="0" cellspacing="0" border="0" class="dynamicTable display table table-bordered" width="100%">
					<thead>
						<tr>
							<th><center>No.</center></th>
							<th>Edit</th>
							<th>Foto Ruas</th>
							<th>Periode</th>
							<th>Nama Kota</th>
							<th>No. Ruas 1</th>
							<th>No. Ruas 2</th>
							<th>No. Ruas 3</th>
							<th>Nama Ruas</th>
							<th>Panjang</th>
							<th>Hotmix Baik</th>
							<th>Hotmix Sedang</th>
							<th>Hotmix RR</th>
							<th>Hotmix RB</th>
							<th>Lapen Baik</th>
							<th>Lapen Sedang</th>
							<th>Lapen RR</th>
							<th>Lapen RB</th>
							<th>LPC</th>
							<th>Tanah</th>
							<th>Hutan</th>
							<th>Pulau</th>
							<th>RCI</th>
							<th>IRI</th>
							<th>Lihat Detail Rute</th>
						</tr>
					</thead>
					<?php
						$no=0;
						foreach($data_rj as $row){
						$no++;
					?>
						<tr class="odd gradeX">
							<td><center><?php echo $no; ?></center></td>
							<td>
								<div class="controls center">
									<a href="javascript:edit(<?php echo $row["ID_RUAS"]; ?>)" title="Edit Data" class="tip"><span class="icon14 icomoon-icon-pencil"></span></a>
								</div>
							</td>
							<td><a href="<?php echo site_url('upload/index/'.$row['ID_RUAS'])?>" class="upload" ><i class="icon14 icomoon-icon-image"></i></a></td>
							<td>
								<?php echo date('d-m-Y',strtotime($row["TGL_AWAL"]))?><br>
								- <br>
								<?php echo date('d-m-Y',strtotime($row["TGL_AKHIR"]))?>
							</td>
							<td><?php echo $row["NAMA_KOTA"];?></td>
							<td><?php if($row["NO_RUAS1"] == "" || $row["NO_RUAS1"] == NULL){echo "-";}else{echo $row["NO_RUAS1"];}?></td>
							<td><?php if($row["NO_RUAS2"] == "" || $row["NO_RUAS2"] == NULL){echo "-";}else{echo $row["NO_RUAS2"];}?></td>
							<td><?php if($row["NO_RUAS3"] == "" || $row["NO_RUAS3"] == NULL){echo "-";}else{echo $row["NO_RUAS3"];}?></td>
							<td><?php echo $row["NAMA_RUAS"]?></td>
							<td><?php if($row["PANJANG"] == "" || $row["PANJANG"] == 0 || $row["PANJANG"] == NULL){echo "-";}else{echo $row["PANJANG"];}?></td>
							<td><?php if($row["HOTMIX_BAIK"] == "" || $row["HOTMIX_BAIK"] == 0 || $row["HOTMIX_BAIK"] == NULL){echo "-";}else{echo $row["HOTMIX_BAIK"];}?></td>
							<td><?php if($row["HOTMIX_SEDANG"] == "" || $row["HOTMIX_SEDANG"] == 0 || $row["HOTMIX_SEDANG"] == NULL){echo "-";}else{echo $row["HOTMIX_SEDANG"];}?></td>
							<td><?php if($row["HOTMIX_RR"] == "" || $row["HOTMIX_RR"] == 0 || $row["HOTMIX_RR"] == NULL){echo "-";}else{echo $row["HOTMIX_RR"];}?></td>
							<td><?php if($row["HOTMIX_RB"] == "" || $row["HOTMIX_RB"] == 0 || $row["HOTMIX_RB"] == NULL){echo "-";}else{echo $row["HOTMIX_RB"];}?></td>
							<td><?php if($row["LAPEN_BAIK"] == "" || $row["LAPEN_BAIK"] == 0 || $row["LAPEN_BAIK"] == NULL){echo "-";}else{echo $row["LAPEN_BAIK"];}?></td>
							<td><?php if($row["LAPEN_SEDANG"] == "" || $row["LAPEN_SEDANG"] == 0 || $row["LAPEN_SEDANG"] == NULL){echo "-";}else{echo $row["LAPEN_SEDANG"];}?></td>
							<td><?php if($row["LAPEN_RR"] == "" || $row["LAPEN_RR"] == 0 || $row["LAPEN_RR"] == NULL){echo "-";}else{echo $row["LAPEN_RR"];}?></td>
							<td><?php if($row["LAPEN_RB"] == "" || $row["LAPEN_RB"] == 0 || $row["LAPEN_RB"] == NULL){echo "-";}else{echo $row["LAPEN_RB"];}?></td>
							<td><?php if($row["LPC"] == "" || $row["LPC"] == 0 || $row["LPC"] == NULL){echo "-";}else{echo $row["LPC"];}?></td>
							<td><?php if($row["TANAH"] == "" || $row["TANAH"] == 0 || $row["TANAH"] == NULL){echo "-";}else{echo $row["TANAH"];}?></td>
							<td><?php if($row["HUTAN"] == "" || $row["HUTAN"] == 0 || $row["HUTAN"] == NULL){echo "-";}else{echo $row["HUTAN"];}?></td>
							<td><?php echo $row["PULAU"]?></td>
							<td><?php echo $row["RCI"]?></td>
							<td><?php echo $row["IRI"]?></td>
							<td><a href="<?php echo site_url('ruas_jalan/lihat_rute/'.$row['ID_RUAS'])?>" target="_blank" title="Lihat titik rute"><span class="icon14 icomoon-icon-map"></span></a></td>
						</tr>
					<?php
					}
					?>
					</tbody>
				</table>
			</div>
		</div>
	</div>
</div>
<div id="inline1" style="width:400px;display: none;">
	<h3>Etiam quis mi eu elit</h3>
	<p>
		Lorem ipsum dolor sit amet, consectetur adipiscing elit. 
		Etiam quis mi eu elit tempor facilisis id et neque. 
		Nulla sit amet sem sapien. Vestibulum imperdiet porta ante ac ornare. 
		Nulla et lorem eu nibh adipiscing ultricies nec at lacus. 
		Cras laoreet ultricies sem, at blandit mi eleifend aliquam. 
		Nunc enim ipsum, vehicula non pretium varius, cursus ac tortor. 
		Vivamus fringilla congue laoreet. Quisque ultrices sodales orci, quis rhoncus justo auctor in. 
		Phasellus dui eros, bibendum eu feugiat ornare, faucibus eu mi. 
		Nunc aliquet tempus sem, id aliquam diam varius ac. 
		Maecenas nisl nunc, molestie vitae eleifend vel, iaculis sed magna. 
		Aenean tempus lacus vitae orci posuere porttitor eget non felis. 
		Donec lectus elit, aliquam nec eleifend sit amet, vestibulum sed nunc.
	</p>
</div>

<link href="<?php echo $this->config->item('plugin_path');?>tables/dataTables/jquery.dataTables.css" type="text/css" rel="stylesheet" />
<link href="<?php echo $this->config->item('plugin_path');?>tables/dataTables/TableTools.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="<?php echo $this->config->item('plugin_path');?>tables/dataTables/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="<?php echo $this->config->item('plugin_path');?>tables/dataTables/TableTools.min.js"></script>
<script type="text/javascript" src="<?php echo $this->config->item('plugin_path');?>tables/dataTables/ZeroClipboard.js"></script>
<script type="text/javascript" src="<?php echo $this->config->item('plugin_path');?>tables/responsive-tables/responsive-tables.js"></script>
<script type="text/javascript" src="<?php echo $this->config->item('js_path');?>datatable.js"></script>
<script type="text/javascript" src="<?php echo $this->config->item('plugin_path');?>misc/nicescroll/jquery.nicescroll.min.js"></script>


<script type="text/javascript">
function edit(id){
	document.location = "<?php echo site_url("ruas_jalan/form_rj")?>/"+id;
}
function ganti_periode(){
	var periode = $("#periode").val();
	document.location = "<?php echo site_url('ruas_jalan/grid_rj')?>/"+periode;
}
$(document).ready(function() {
	$('.upload').fancybox({
		'width'         : '100%',
		'height'        : 'auto',
		'autoScale'     : true,
		'transitionIn'  : 'none',
		'transitionOut' : 'none',
		'type'          : 'iframe'
	});
});
</script>